package nl.infodation.emr.pricingservice.business.impl;

import java.util.Hashtable;
import java.util.List;

import nl.infodation.emr.pricingservice.business.SystemBusiness;
import nl.infodation.emr.pricingservice.dao.DAOFactory;
import nl.infodation.emr.pricingservice.entity.Environment;
import nl.infodation.emr.pricingservice.entity.Role;
import nl.infodation.emr.pricingservice.entity.SystemDetail;
import nl.infodation.emr.pricingservice.entity.SystemValueRef;

/**
 * @author SUCCESS\tungo
 *
 */
public class SystemBusinessImpl implements SystemBusiness {

	private static SystemBusiness instance = null;
	
	private SystemBusinessImpl() { }
	
	public static SystemBusiness getInstance() {
		if (instance == null) {
			instance = new SystemBusinessImpl();
		}
		return instance;
	}

	/* (non-Javadoc)
	 * @see nl.infodation.emr.pricingservice.business.SystemBusiness#getEnvironment(java.lang.Integer)
	 */
	@Override
	public Environment getEnvironment(Integer id) {
		return DAOFactory.getEnvironmentDAO().get(id);
	}

	/* (non-Javadoc)
	 * @see nl.infodation.emr.pricingservice.business.SystemBusiness#getSysValRef(java.lang.Integer)
	 */
	@Override
	public SystemValueRef getSysValRef(Integer id) {
		return DAOFactory.getSystemValueRefDAO().get(id);
	}

	@Override
	public Hashtable<String, List<SystemDetail>> findSystemDetailByRoleAndLangAndSys(
			String roleName, Integer langId, String... sysNames) {
		return DAOFactory.getSystemValueRefDAO().findByRoleAndLangAndSys(roleName, langId, sysNames);
	}

	@Override
	public List<Role> findAllRoles() {
		return DAOFactory.getRoleDAO().findAll();
	}
	
}
